/*
 * Kinect Player
 * Kulikov Victor
 * kulikov.victor@gmail.com
 * GNU Lisence 2011
 */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <Kinect/kinectstorage.h>
#include "Kinect/kinectframe.h"
#include "Camera/steriocalibration.h"
#include "Kinect/kinectsync.h"
namespace Ui {
    class MainWindow;
}
using namespace camera;
using namespace kinect;
class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void changeEvent(QEvent *e);
signals:
    void sendFrames(KinectFrame frame);
private:
    Ui::MainWindow *ui;
    KinectStorage* storage;
    QTimer* timer;
    QTimer* rtimer;
    bool openFile(std::string fname);
    KinectFrame current;
    QString storename;
    SterioCalibration calib;
    QTimer xtimer;
    /*! Gets kinectframe
      * \param id device id
      */
    KinectFrame grabFrame(int id);
    KinectSync ks;
    //CallibrationResult cr;
private slots:
    void currentFrameChanged(KinectFrame frame);
    void on_actionCalibrate_triggered();
    void on_actionTest_triggered();
    void on_actionSave_Point_Cloud_triggered();
    void on_actionRecord_triggered();
    void on_actionOpen_triggered();
    void on_actionControls_triggered();
    void on_actionAbout_triggered();
    void on_actionClose_triggered();
    void onSeek(qlonglong x);
    void onTimer();
    void grabPicture();
    void stopRecord();
    void tryCallib();
};

#endif // MAINWINDOW_H
